package com.ctshk.sapp.order.bus.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.TokenUser;
import com.ctshk.rpc.order.bus.req.BusManualOrderReq;
import com.ctshk.rpc.order.bus.service.IBusManualOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 巴士手工单（外挂单） 前端控制器
 * </p>
 *
 * @author 彭柳霖
 * @since 2021-02-24
 */
@Api(value="预订中心-巴士添加外挂单", tags="预订中心-巴士添加外挂单")
@RestController
@RequestMapping("/bus-manual-order")
public class BusManualOrderController extends BaseController {

    @DubboReference
    IBusManualOrderService busManualOrderService;

    @ApiOperation(value="添加外挂单", notes="添加外挂单")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.ADD, operTitle = "添加外挂单", operDesc = "添加外挂单")
    @PostMapping("/save")
    public Result<Long> saveBusMaunalOrder(@RequestBody @Valid BusManualOrderReq busManualOrderReq) {
        TokenUser user = getCurrentUser(getRequest());
        return busManualOrderService.addBusManualOrder(busManualOrderReq,user);
    }


}
